<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="../style.css" type="text/css" rel="stylesheet" />
    <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../prettify/prettify.js"></script>
    <title>QDCM: DICOM for Qt</title>
</head>
<body onload="prettyPrint()">
    <p><a href="../index.html"><< Back to the main page</a></p>
    <h2>Constructing DICOM dataset</h2>
    
    <p class="text">
        DICOM dataset can be easily constructed by inserting tags into an empty dataset
        or populating an existing one:
        <pre class="prettyprint lang-cpp linenums">
DcmDataset dataset;

dataset.setTagValue("MediaStorageSOPClassUID", "1.2.840.10008.5.1.4.1.1.1");
dataset.setTagValue("MediaStorageSOPInstanceUID", "1.2.3.4.5.6.7");
dataset.setTagValue("StudyInstanceUID", "1.2.3.4.5.6.7.1");
dataset.setTagValue("SeriesInstanceUID", "1.2.3.4.5.6.7.1.1");
dataset.setTagValue("SOPClassUID", "1.2.840.10008.5.1.4.1.1.1");
dataset.setTagValue("SOPInstanceUID", "1.2.3.4.5.6.7");
dataset.setTagValue("PatientId", "BJ750315");
dataset.setTagValue("PatientName", "Brown^John");
dataset.setTagValue("PatientSex", "M");
dataset.setTagValue("PatientBirthDate", QDate(1975, 3, 15));
</pre>                
    </p>
    
    <p class="text">
        Another way to populate a dataset is by using modules. Modules are sets
        of tags grouped logically in a single object:
        <pre class="prettyprint lang-cpp linenums">
DcmDataset dataset;

DcmModulePatient patient;

patient.setPatientId("BJ750315");
patient.setPatientName("Brown^John");

dataset.attachModule(patient);
</pre>                

        Modules contain mandatory tags well as optional tags. One may call <code>isValid()</code>
        method of a module object to check that all mandatory tags has been defined.
        
    </p>
    
    <hr>
    <address>
        ©2012 by
        <a href="mailto:arthur.benilov@gmail.com">Arthur Benilov</a>
        <p class="hostedby">
            <a href="http://sourceforge.net/">
                Project Web Hosted by
                <br>
                <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=265589&type=13" alt="SourceForge.net">
            </a>
        </p>
    </address>

</body>    
</html>